{layout name="layout/layout" /}
<style>
    .box {
        position: absolute;
        z-index: 999;
        height: 150px;
        background: #f5f5f5;
        overflow-y: auto;
        width: 500px;
    }

    ul,
    li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    li {
        font-size: 14px;
    }

    li.current {
        background: #CCCCCC;
        color: #0000FF;
        cursor: pointer;
    }

    li:hover {
        background: #CCCCCC;
        color: #0000FF;
        cursor: pointer;
    }

    #list_li li {
        height: 30px;
        line-height: 30px;
        text-align: left;
        border-bottom: 1px solid #fff;
        padding-left: 10px;
    }
</style>
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">修改资料</li>
    </ul>
</div>
<form class="layui-form1" method="post" id="form">
    <div class="layui-form-item">
        <label class="layui-form-label">客户昵称</label>
        <div class="layui-input-block">
            <input class="layui-input" type="text" name="user_name" value="{$data['user_name']}" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">推荐人</label>
        <div class="layui-input-block" >
            <input type="text" name="title" required  lay-verify="required" autocomplete="off" class="layui-input" value="{$data['referee']}" readonly style="background-color:#F5F5F5">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <select name="user_sex" style="width: 100px;height: 37px">
                <option value="1" {if condition="$data['user_sex']==1" } selected {/if}>男</option>
                <option value="0" {if condition="$data['user_sex']==0" } selected {/if}>女</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所在公司</label>
        <div class="layui-input-block">
            <input id="company" class="layui-input" type="text" name="company" value="{$data['company']}" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">查询到公司</label>
        <div class="layui-input-block">
            <input id="chaxun" class="layui-input" type="text" name="company_name" value="{$data['companyname']}" />
            <div class="box" id="box">
                <ul id="list_li" class="list-group">

                </ul>
            </div>
            <input id="companyname" type="hidden" value="{$data['companyname']}" name="companyname">
            <input id="companyname_coding" type="hidden" value="{$data['company_id']}" name="companyname_coding">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">职位</label>
        <div class="layui-input-block">
            <input class="layui-input" type="text" name="position" value="{$data['position']}" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机</label>
        <div class="layui-input-block">
            <input class="layui-input" maxlength="11" type="text" name="user_tel" value="{$data['user_tel']}" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否通过</label>
        <div class="layui-input-block" style="line-height: 36px;">
                <input {if condition="$data['is_pass'] == 0" }checked="checked" {/if} type="radio" name="is_pass" value="0">不通过&nbsp;&nbsp;
                <input {if condition="$data['is_pass'] == 1" }checked="checked" {/if} type="radio" name="is_pass" value="1">通过
               
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="user_id" value="{$data['user_id']}">
            <input onclick="form.submit()" type="button" class="layui-btn" value="保存" />
        </div>
    </div>
</form>
<script>
    $(function () {
        $('#box').css('display', 'none');
        $('#chaxun').on('input propertychange', function () {
            var data = $(this).val();
            $.post("{:Url('admin/user/get_cmplist')}", { company: data }, function (data) {
                $('#box').css('display', 'block');
                $('#list_li li').remove();
                if (data.Status) {
                    $('#list_li li').remove();
                    for (var i = 0; i < data.JData.length; i++) {
                        $('#list_li').append('<li companyname="' + data.JData[i].f_companyname + '" companyname_coding="' + data.JData[i].f_intermediaryid + '" class="list_li">' + data.JData[i].f_companyname + '</li>');

                    }
                }
            }, 'json');
        });
        $("body").on("click", '.list_li', function () {
            var companyname = $(this).attr('companyname');
            var companyname_coding = $(this).attr('companyname_coding');
            $('#chaxun').val(companyname);
            $("#companyname").val(companyname);
            $("#companyname_coding").val(companyname_coding);
            $('#box').css('display', 'none');
        });
    });
</script>